package com.lqd.mall.system;

import com.lqd.mall.basis.response.CommonResult;
import com.lqd.mall.basis.response.Result;
import com.lqd.mall.interaction.system.SysMenuEntity;
import com.lqd.mall.interaction.system.qo.MenuQueryQo;
import com.lqd.mall.interaction.system.vo.RouterVo;
import com.lqd.mall.security.annotation.RequiresPermissions;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 零起点
 * @create 2022-02-23 23:39
 */
@RequestMapping("menu")
public interface SysMenuControllerApi {

    /**
     * 获取路由信息
     *
     * @return 路由信息
     */
    @GetMapping("getRouters")
    @ApiOperation("获取路由信息")
    public Result<List<RouterVo>> getRouters();

    /**
     * 获取路由信息
     *
     * @return 路由信息
     */
    @GetMapping("list")
    @ApiOperation("获取菜单信息")
    public Result<List<SysMenuEntity>> list(MenuQueryQo menuQueryQo);


    @GetMapping("{menuId}")
    @ApiOperation("获取菜单详情信息")
    @RequiresPermissions("system:menu:query")
    public Result<SysMenuEntity> findMenuById(@PathVariable(name = "menuId") Integer menuId);

    @PostMapping
    @ApiOperation("获取菜单详情信息")
    @RequiresPermissions("system:menu:add")
    public CommonResult sava( @Validated @RequestBody SysMenuEntity menu);
}
